from pathlib import Path
from openai import OpenAI
import openai


api_key='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'
client = OpenAI(api_key=api_key)
openai.api_key = api_key


speech_file_path = Path(__file__).parent / "speech.mp3"

#voice : alloy echo fable onyx nova shimmer
response = client.audio.speech.create(
  model="tts-1",
#   voice="alloy",
  voice="nova",
#   input="Today is a wonderful day to build something people love!"
  # input="今天天气真不错啊！"
  input='最近の円相場の状況について詳しく教えてください。'
)

response.stream_to_file(speech_file_path)